package de.kardass.jsmatep.in;

import java.util.List;

/**
 * Convenience class to use buffered import processing. This class holds a
 * {@link BufferedRecordMapperListener} as a listener to collect all mapped
 * value objects.
 *
 * @author Manfred Kardass (manfred@kardass.de)
 *
 * @param <T>   The relating value object
 */
public class BufferedImportProcessor<T> extends ImportProcessor<T> {

    protected final BufferedRecordMapperListener<T> bufferedRecordMapperListener;

    /**
     * @param configFileName
     */
    public BufferedImportProcessor(final String configFileName) {
        super(configFileName);
        bufferedRecordMapperListener = new BufferedRecordMapperListener<T>();
        registerListener(bufferedRecordMapperListener);
    }

    /**
     * @return Mapped value objects.
     */
    public final List<T> getMappedValueObjects() {
        return bufferedRecordMapperListener.getMappedValueObjects();
    }

    /**
     * @return Size / quantity of buffered value objects
     */
    public final int size() {
        return bufferedRecordMapperListener.size();
    }

}
